package cn.monkey.family.data.crud.repository;


import cn.monkey.family.data.QueryRequest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.NoRepositoryBean;

import java.util.List;
import java.util.Optional;

@NoRepositoryBean
public interface QueryRequestRepository<T, ID, Q extends QueryRequest>
        extends CrudRepository<T, ID>, ListCrudRepository<T, ID>, ListPagingAndSortingRepository<T, ID> {

    Optional<T> findOneByQueryRequest(Q queryRequest);

    List<T> findAllByQueryRequest(Q queryRequest, Sort sort);

    Page<T> findPageByQueryRequest(Q queryRequest, Pageable pageable);
}
